<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../taglibs.jsp" %>
<script type="text/javascript">
	$(function() {
		
		$("#supplier").change(function(){
			//获得供应商的Id
			var supplierId = $(this).val();
			$.ajax({
				url:"${path}/product_loadpt",
				type:"post",
				dataType:"text",
				data:"erpQuery.supplierId="+supplierId,
				success:function(responseText){
					//把字符串转换成json格式的对象数组[{"name":"鞋","productTypeId":4,"supplierId":0},{"name":"上衣","productTypeId":3,"supplierId":0}]
					$("#productType").empty();
					$("#productType").append("<option value=''>--请选择--</option>")
					var jsonObj = $.parseJSON(responseText);
					for(var i = 0 ; i < jsonObj.length; i++){
						$("#productType").append("<option value='"+jsonObj[i].productTypeId+"'>"+jsonObj[i].name+"</option>");
					}
					
				}
			});
			
		})
	});
	
	function submitUpdateProduct(){
	
		
		var result = "";
		$("#productForm").ajaxSubmit({
			dataType:"text",
			async:false,
			success:function(responseText){
				
				result = responseText;
			}
		})
		return result;
	}
</script>
<div class="content-right">
	<div class="content-r-pic_w">
		<div style="margin:8px auto auto 12px;margin-top:6px">
			<span class="page_title">商品管理</span>
		</div>
	</div>
	<div class="content-text">
		<div class="square-order">
			<form id="productForm" action="${path }/product_update" method="post">
			
			<input type="hidden" name="product.productId" value="<s:property value="product.productId"/>">
  			<div style="border:1px solid #cecece;">
				<table width="100%"  border="0" cellpadding="0" cellspacing="0">
				  <tr bgcolor="#FFFFFF">
				    <td>&nbsp;</td>
				  </tr>
				</table>
				<table width="100%"  border="0" cellpadding="0" cellspacing="0">
				    <tr  bgcolor="#FFFFFF">
				      <td width="18%" height="30" align="center">供&nbsp;应&nbsp;商</td>
				      <td width="32%">
				      		
							<s:select cssStyle="width:190px" id="supplier" list="#suppliers" name="product.productType.supplier.supplierId" headerKey="" headerValue="--请选择--" listKey="supplierId" listValue="name"></s:select>
				      </td>
				      <td width="18%"align="center">商品类别</td>
				      <td width="32%">
				      		<!-- <select id="productType" name="product.productType.productTypeId" style="width:190px">
								<option value="">----请-选-择----</option>
								
							</select> -->
							<s:select id="productType" cssStyle="width:190px" list="#pts" name="product.productType.productTypeId" headerKey="" headerValue="--请选择--" listKey="productTypeId" listValue="name"></s:select>
					  </td>
				    </tr>
				    <tr bgcolor="#FFFFFF">
					  <td colspan="4">&nbsp;</td>
					</tr>
				    <tr  bgcolor="#FFFFFF">
				      <td align="center">商品名称</td>
				      <td>
				      	<s:textfield name="product.name" size="25"></s:textfield>
				      </td>
				      <td  align="center">产&nbsp;&nbsp;&nbsp;&nbsp;地</td>
				      <td >
				      	<s:textfield name="product.origin" size="25"></s:textfield>
				      </td>
				    </tr>
				     <tr bgcolor="#FFFFFF">
					  <td colspan="4">&nbsp;</td>
					</tr>
				    <tr  bgcolor="#FFFFFF">
				      <td height="30" align="center">生产厂家</td>
				      <td>
				      	<s:textfield name="product.producer" size="25"></s:textfield>
				      <td align="center">单&nbsp;&nbsp;&nbsp;&nbsp;位</td>
				      <td>
				      	<s:textfield name="product.unit" size="25"></s:textfield>
					  </td>
				     </tr>
				    <tr bgcolor="#FFFFFF">
					  <td colspan="4">&nbsp;</td>
					</tr>
				    <tr  bgcolor="#FFFFFF">
				      <td height="30" align="center">进货单价</td>
				      <td>
				      	<s:textfield name="product.inPrice" size="25"></s:textfield>
					  </td>
				      <td align="center">销售单价</td>
				      <td>
				      	<s:textfield name="product.outPrice" size="25"></s:textfield>
					  </td>
				    </tr>
				    <tr bgcolor="#FFFFFF">
					  <td colspan="4">&nbsp;</td>
					</tr>
				    <!-- <tr  bgcolor="#FFFFFF">
				      <td height="30" align="center">体&nbsp;&nbsp;&nbsp;&nbsp;积</td>
				      <td>
				      	<input type="text" size="25"/>
					  </td>
				      <td align="center">&nbsp;</td>
				      <td>&nbsp;</td>
				    </tr> -->
				     <tr bgcolor="#FFFFFF">
					  <td colspan="4">&nbsp;</td>
					</tr>
				</table>
			</div>
			<div class="order-botton">
				<div style="margin:1px auto auto 1px;">
					<table width="100%"  border="0" cellpadding="0" cellspacing="0">
					  <tr>
					    <td>
					    	<a href="javascript:document.forms[0].submit()"><img src="${path}/images/order_tuo.gif" border="0" /></a>
					    </td>
					    <td>&nbsp;</td>
					    <td><a href="#"><img src="${path}/images/order_tuo.gif" border="0" /></a></td>
					    <td>&nbsp;</td>
					    <td><a href="#"><img src="${path}/images/order_tuo.gif" border="0" /></a></td>
					  </tr>
					</table>
				</div>
			</div>
			</form>
		</div><!--"square-order"end-->
	</div><!--"content-text"end-->
	<div class="content-bbg"><img src="${path}/images/content_bbg.jpg" /></div>
</div>
